package linwen.wang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import linwen.wang.entity.Order;
import linwen.wang.mapper.OrderMapper;
import linwen.wang.service.IOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wlw
 * @since 2023-04-05
 */
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {

    @Override
    public List<Order> getByUserId(Long userId) {
        if(null == userId){
            return Collections.emptyList();
        }
        return this.list(new QueryWrapper<Order>().lambda().eq(Order::getUserId,userId));
    }
}
